package com.zz.controller;

import com.zz.entity.DiscussPost;
import com.zz.entity.Mypage;
import com.zz.service.IndexService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
public class IndexController {
    @Autowired
    private IndexService indexService;

    @RequestMapping("/")
    public String login(){
        return "site/login";
    }
    @RequestMapping("/index")
    public String indexList(Mypage mypage,Model model){

        Mypage page = indexService.page(mypage);

        List<DiscussPost> list = indexService.list();
//        mypage =indexService.selectAll(mypage);
        model.addAttribute("page",page);
        model.addAttribute("discussPost",list);
        return "index";
    }
}
